﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using AEA.RSSFeedReaderLib;

namespace AEA.RSSFeedReader
{
    /// <summary>
    /// Class for design time data
    /// </summary>
    public class ChannelFeedDesignTime : List<ChannelFeed>
    {
        /// <summary>
        /// Initialize a new instance of the ChannelDesignTime class.
        /// </summary>
        public ChannelFeedDesignTime()
        {
            this.AddRange(ChannelFeedDesignTime.GetChannels());
        }

        #region Private Static methods
        /// <summary>
        /// Creates and returns dummy data for item feeds.
        /// </summary>
        /// <returns>A collection of <see cref="AEA.RSSFeedReader.ItemFeed"/></returns>
        private static ItemFeedCollection GetItemFeedsCollection()
        {
            ItemFeedCollection _itemFeeds = new ItemFeedCollection();
            ItemFeed itemFeed;

            itemFeed = new ItemFeed("Test1", null, "http://www.nba.com");
            _itemFeeds.Add(itemFeed);

            itemFeed = new ItemFeed("Test2", null, "http://www.nba.com");
            _itemFeeds.Add(itemFeed);

            itemFeed = new ItemFeed("Test3", null, "http://www.nba.com");
            _itemFeeds.Add(itemFeed);

            return _itemFeeds;
        }

        /// <summary>
        /// Creates dummy data for channel feeds.
        /// </summary>
        /// <returns>A collection of <see cref="AEA.RSSFeedReader.ChannelFeed"/>.</returns>
        private static ChannelFeedCollection GetChannels()
        {
            ChannelFeedCollection channels = new ChannelFeedCollection();
            ItemFeedCollection itemFeeds = new ItemFeedCollection();

            channels.Add(new ChannelFeed("Channel1", null, null, null, null));
            channels.Add(new ChannelFeed("Channel2", null, null, null, null));
            channels.Add(new ChannelFeed("Channel3", null, null, null, null));
            channels.Add(new ChannelFeed("Channel4", null, null, null, null));
            channels.Add(new ChannelFeed("Channel5", null, null, null, null));

            foreach (ChannelFeed channel in channels)
            {
                channel.ItemFeeds = GetItemFeedsCollection();
            }

            return channels;
        }
        #endregion
    }
}
